package com.huyanqi.front.rest.resource.impl;

import java.util.List;

import javax.annotation.Resource;

import com.huyanqi.core.RetdObj;
import com.huyanqi.entity.Diy;
import com.huyanqi.front.rest.RespCode;
import com.huyanqi.front.rest.resource.DiyListResource;
import com.huyanqi.front.rest.resp.DiyListResp;
import com.huyanqi.front.rest.service.DiyRestService;

public class DiyResourceImpl implements DiyListResource{

	private DiyRestService restService;
	
	@Resource(name="DiyRestService")
	public void setRestService(DiyRestService restService) {
		this.restService = restService;
	}
	public DiyRestService getRestService() {
		return restService;
	}
	@Override
	public DiyListResp findLatestDiy(Integer pageSize, Integer pageNum) {
		DiyListResp dlr = new DiyListResp();
		RetdObj<List<Diy>> retd = restService.findLatestDiy(pageSize,pageNum);
		dlr.setData(retd.getRealObj());
		dlr.setCode(RespCode.valueOf(retd.getCode()));
		return dlr;
	}
	
}
